var GZSprite = cc.Sprite.extend({
	_currentRotation:0,
	mm_spHero:null,
	mm_Status:"",
	shengshu:10,
	changdu:50,
	da_banjin:1000,
	xiao_banjin:50,
	fanwei:Math.PI/3,
	jiaodu:0,
	fangxian:1,
	fangxian2:1,
	shifouzhuazhu:0,
	Draw:null,
	ctor:function(){
		this._super();
//		this.initWithFile("res/s8.png");
//		this._init();
		mm_spHero=cc.Sprite.create(res.gouzhi_png);
		this.addChild(mm_spHero,2);
		mm_Status=g_Status_Normal;
		Draw=new cc.DrawNode();
		this.addChild(Draw, 1);
//		Draw.clear();
//		Draw.drawSegment(
//				cc.p(100, 100),// 起点
//				cc.p(500,-900), // 终点
//				2, // 线粗
//				cc.color(255,0, 0, 200) // 颜色
//				);
	},
	//状态设置
	setStatus:function(str){
		//cc.log("123",mm_Status);
		mm_Status=str;
	},
	getStatus:function(){
		//cc.log("123",mm_Status);
		return mm_Status;
	},
	getFanXiang2:function(){
		return this.fangxian2;
	},
	setFanXiang2:function(){
		this.fangxian2=-1;
	},
	//回拉速度设置
	setShengShu:function(value){
		this.shengshu=value;
		//cc.log("this.shengshu=",this.shengshu);
	},
	//获取勾坐标
	getGouZhiPosition:function(){
		var arr=[mm_spHero.x+this.x,mm_spHero.y+this.y];
		return arr;
	},
	getGouZhiRect:function(){
		//cc.log("this.x=",this.x,this.y);
		var gouzhiRect2=mm_spHero.getBoundingBox();
		gouzhiRect2.x+=this.x;
		gouzhiRect2.y+=this.y;
		return gouzhiRect2;
	},
	getShifouzhuazhu:function(){
		return this.shifouzhuazhu;
	},
	setShifouzhuazhu:function(value){
		this.shifouzhuazhu=value;
	},
	//设置,获取shifouzhuazhu属性
	update:function(dt){
		this.setRotation(this._currentRotation);

		
		
		if (mm_Status==g_Status_Normal) {
			//cc.log("12312312");
			this.jiaodu -=  this.fangxian * Math.PI / 90;
			if (this.jiaodu>this.fanwei)
			{
				this.fangxian = 1;
			}
			if (this.jiaodu<-1*this.fanwei)
			{
				this.fangxian = -1;
			}//摆动
			
			
			
		}else if(mm_Status==g_Status_Shut){
			if (this.shifouzhuazhu==0) {
				this.changdu +=  this.fangxian2 * 10;
				if (this.changdu>this.da_banjin)
				{
					this.fangxian2 = -1;
				}
				if (this.changdu<this.xiao_banjin)
				{
					this.fangxian2 = 1;
					mm_Status=g_Status_Normal;
//					this.shifozhuandong = true;
					this.shifouzhuazhu=0;
				}
			} else {
				this.fangxian2 = -1;
				this.changdu +=  this.fangxian2 * this.shengshu;
				if (this.changdu<this.xiao_banjin)
				{
					//得分调用 
					this.fangxian2 = 1;
					mm_Status=g_Status_Normal;
//					this.shifozhuandong = true;
					this.shifouzhuazhu=0;
				}
			}
		}
		mm_spHero.x=this.changdu*Math.cos(Math.PI/2+this.jiaodu);
		mm_spHero.y=-this.changdu*Math.sin(Math.PI/2+this.jiaodu);
		mm_spHero.setRotation(this.jiaodu * 180 / Math.PI);

		Draw.clear();
		Draw.drawSegment(
				cc.p(Math.floor(Math.random()*3)+2, Math.floor(Math.random()*2)+2),// 起点
				cc.p(mm_spHero.x,mm_spHero.y), // 终点
				1.5, // 线粗
				cc.color(127,127, 127, 255) // 颜色
		);
	}
});